package com.zhiwei.common.exception;

import com.zhiwei.common.constant.ErrorEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author ZHIWEI.YANG
 * @createtime 2019/2/1 - 16:39
 * @decription 自定义异常
 **/
@Data
@EqualsAndHashCode(callSuper = true)
public class BasePublishException extends RuntimeException {

    /**
     * 异常码
     */
    private String code;

    public BasePublishException(ErrorEnum errorEnum) {
        super(errorEnum.getMsg());
        this.code = errorEnum.code;
    }

    public BasePublishException(String code, String msg) {
        super(msg);
        this.code = code;
    }

    public BasePublishException(String msg, Exception e) {
        super(msg, e);
    }
}
